#ifndef _COBJECT_H_
#define _COBJECT_H_

#include <d3dx9.h>
#include "Sprite.h"
#include "Camera.h"
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <list>
#include "Collision.h"

using namespace std;

enum OBJECT_TYPE
{
	OBJECT_MARIO, OBJECT_LAND, OBJECT_PIPE, OBJECT_ITEM, OBJECT_ENEMY, OBJECT_STATIC
};

class Object
{
public:
	Sprite* _sprite;
	
	int _id;
	int _type;
	float _x;
	float _y;

	float _width;
	float _height;
	float _vx;
	float _vy;
	float _accelX;
	float _accelY;

	int _state;
	int _direction;

	bool _isStateChange;

	bool _isActiveMushRoom;

	 
public:
	//D3DXVECTOR2 m_collisionResponse;

	Object();
	
	Object(int id, float x, float y);
	Object(int id, float x, float y, int state);
	~Object();

	float getPosX() { return _x; }
	float getPosY() { return _y; }
	void setPosX(float x) {_x = x;}
	void setPosY(float y) {_y = y;}
	int getIDObjType() { return _type; }
	void setIDObjType(int obj_type) { this->_type = obj_type; }
	int getIDObj() { return _id; }
	void setIDObj(int _id) { this->_id = _id; }

	/*float getPosX2() { return _x2; }
	float getPosY2() { return _y2; }*/

	float getVelocX() { return _vx; }
	float getVelocY() { return _vy; }
	void setVelocX(float vx) {_vx = vx;}
	void setVelocY(float vy) {_vy = vy;}

	float getAccelX() {return _accelX;}
	float getAccelY() {return _accelY;}
	void setAccelX(float _accelX) {this->_accelX = _accelX;}
	void setAccelY(float _accelY) {this->_accelY = _accelY;}

	float getWidth() { return _width; }
	float getHeight() { return _height; }

	Box getBox();

	Sprite* getSprite() {return _sprite;}

	int getObjState() {return _state;}

	virtual OBJECT_TYPE getObjectType();							//mac dinh la obj scene

	void setIsChangeState(bool isStateChange) {this->_isStateChange = isStateChange;}
	bool getIsChangeState() {return _isStateChange;}
	 
	virtual void Update(list<Object*> *_list, float gameTime); // Update vi tri theo thoi gian
	virtual void Render(int vpX, int vpY);

	virtual void changeState(int state) {this->_state = state;}
 
};
#endif